﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace MLVS.AppUtils
{
    class StringUtils
    {
        public static string SubstringMax(string str, int max)
        {
            if (!string.IsNullOrEmpty(str) && str.Length > max)
                return str.Substring(0, max);
            else if (string.IsNullOrEmpty(str))
                return "";
            else return str;
        }

        public static string toStringFormat(decimal val)
        {

            string temp = "";
            temp = val.ToString("#.####", CultureInfo.InvariantCulture);
            if (string.IsNullOrEmpty(temp))
                temp = "0";
            return temp;


        }

    }
}
